<template>
  <van-tabbar v-model="active" @change="onChange" fixed>
    <van-tabbar-item icon="home-o">首页</van-tabbar-item>
    <van-tabbar-item icon="search">分类</van-tabbar-item>
    <van-tabbar-item icon="friends-o">值得买</van-tabbar-item>
    <van-tabbar-item icon="setting-o">购物车</van-tabbar-item>
    <van-tabbar-item icon="setting-o">个人</van-tabbar-item>
  </van-tabbar>
</template>

<script>
export default {
  name: "TableBar",
  methods: {
    onChange(index) {
      switch (index) {
        case 0:
          break;
        case 1:
          this.$router.push("/category");
          break;
        case 2:
          break;
        case 3:
          this.$router.push("/cart");
          break;
        case 4:
          this.$router.push("/center");
          break;
        default:
          break;
      }
    },
  },
  data() {
    return {
      active: 0,
    };
  },
};
</script>

<style lang="less" scoped></style>
